package com.demo.test.graph;

import java.util.ArrayList;
import java.util.List;

public class Node {
    private String id;  // 节点的唯一标识符
    private List<Node> neighbors;  // 当前节点的邻居节点（即出度）

    public Node(String id) {
        this.id = id;
        this.neighbors = new ArrayList<>();
    }

    public String getId() {
        return id;
    }

    public void addNeighbor(Node neighbor) {
        neighbors.add(neighbor);
    }

    public List<Node> getNeighbors() {
        return neighbors;
    }

    @Override
    public String toString() {
        return id;
    }
}
